package com.im.web;


//import com.im.interceptor.MenuInterceptor;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.aop.config.AopConfigUtils;
import org.springframework.aop.framework.AopProxy;
import org.springframework.aop.framework.AopProxyFactory;
import org.springframework.aop.framework.AopProxyUtils;
import org.springframework.aop.support.AopUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;

import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import com.im.interceptor.SecurityInterceptor;

@Configuration
//@EnableWebMvc
public class WebMVCConfig extends WebMvcConfigurerAdapter {
	
	private static final Logger logger = LogManager.getLogger(WebMVCConfig.class);
	
	@Autowired
	SecurityInterceptor securityInterceptor;

//	@Autowired
//	MenuInterceptor menuInterceptor;


	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		//添加安全认证拦截器
		registry.addInterceptor(securityInterceptor).addPathPatterns("/**");
		logger.debug("==WebMVCConfig addInterceptor : securityInterceptor");
		
	}

	/**
	 * 以下请求解析器没有效果没有效果
	 */
//	@Override
//	public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
//		// TODO Auto-generated method stub
//		//参数解析加密
//		//super.addArgumentResolvers(argumentResolvers);
//		argumentResolvers.add(argumentResolver);
//		logger.debug("==WebMVCConfig addArgumentResolvers argumentResolver");
//	}
//
//	@Override
//	public void addReturnValueHandlers(List<HandlerMethodReturnValueHandler> returnValueHandlers) {
//		// TODO Auto-generated method stub
//		//参数解析解密
//		super.addReturnValueHandlers(returnValueHandlers);
//	}
//	
	
	
}
